<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>{$Think.lang.goods_list}-{$tpshop_config['shop_info_store_title']}</title>
<meta http-equiv="keywords" content="{$tpshop_config['shop_info_store_keyword']}" />
<meta name="description" content="{$tpshop_config['shop_info_store_desc']}" />
</head>

<body>
<!--------頭部開始-------------->
<include file="Public/header" />
<!--------頭部結束--------------> 
<link rel="stylesheet" type="text/css" href="__STATIC__/css/homehtmleaf-demo.css">
<link rel="stylesheet" href="__STATIC__/css/page.css" type="text/css">
<link rel="stylesheet" href="__STATIC__/css/category.css" type="text/css">

<script type="text/javascript" src="__STATIC__/js/jquery.jqzoom.js"></script> 
<script src="__PUBLIC__/js/pc_common.js"></script>
<script src="__PUBLIC__/js/layer/layer.js"></script><!--彈窗js 參考文檔 http://layer.layui.com/-->

<!--------中間內容-------------->
<div id="warpper" class="clearfix">

  <?php if($goods_list){ ?>

<link rel="stylesheet" type="text/css" href="__STATIC__/css/jquery.bxslider.css">
<script type="text/javascript" src="__STATIC__/js/jquery.bxslider.min.js"></script>
<script type="text/javascript">
$(function(){
	$('.bxslider').bxSlider({
		auto: false
	});
});
</script>
<div class="probanner" >
    <ul class="bxslider">
    
		<if condition="$banner_list neq ''">    
             <foreach name="banner_list" item="v" key="k">
               <li><img src="{$v}" width="100%" /></li>
             </foreach>
 
 		<else/>
            <adv limit="5" item="v" pid="2">
            <li><a href="{$v.ad_link}" <if condition="$v['target'] eq 1">target="_blank"</if>><img src="{$v[ad_code]}" /></a></li>
            </adv>  
       </if>
    </ul>
</div>

<div class="cata_shop_right" id="tracker_category" style="margin-top:-3px;"> 
  
  <!-- 商品列表 -->
  <div class="searchbox" id="search_box_list">
    <div class="list clearfix">
      <ul class="left text12" id="order_ul">
        <!--        <li><a class="col7ac " href1="&sort=recommand&asc=0" style="cursor:pointer;">綜合</a></li>-->
        <li> <a class="col7ac  <if condition="$_GET[sort] eq ''">main</if>" href="<?php echo urldecode(U("/Home/Activity/activityList#search_box_list",$filter_param,''));?>" style="cursor:pointer;">{$Think.lang.default}   </a> </li>
		
		
        <li> <a class="col7ac  <if condition="$_GET[sort] eq 'sales_sum'">main</if>" href="<?php echo urldecode(U("/Home/Activity/activityList#search_box_list",array_merge($filter_param,array('sort'=>'sales_sum')),''));?>" style="cursor:pointer;">{$Think.lang.salesvolume}   </a> </li>
                
        <if condition="$_GET['sort_asc'] eq 'desc'">
        	<li><a class="col7ac  <if condition="$_GET[sort] eq 'shop_price'">main</if>" href="<?php echo urldecode(U("/Home/Activity/activityList#search_box_list",array_merge($filter_param,array('sort'=>'shop_price','sort_asc'=>'asc')),''));?>" style="cursor:pointer;">{$Think.lang.price} <span class="icon-chevron-up "></span></a></li>
        <else />
        	<li><a class="col7ac  <if condition="$_GET[sort] eq 'shop_price'">main</if>" href="<?php echo urldecode(U("/Home/Activity/activityList#search_box_list",array_merge($filter_param,array('sort'=>'shop_price','sort_asc'=>'desc')),''));?>" style="cursor:pointer;">{$Think.lang.price} <span class="icon-chevron-down "></span></a></li>
        </if>    
                
        <li><a class="col7ac  <if condition="$_GET[sort] eq 'comment_count'">main</if>" href="<?php echo urldecode(U("/Home/Activity/activityList#search_box_list",array_merge($filter_param,array('sort'=>'comment_count')),''));?>" style="cursor:pointer;">{$Think.lang.comment} </a></li>
        <li><a class="col7ac  <if condition="$_GET[sort] eq 'is_new'">main</if>"  href="<?php echo urldecode(U("/Home/Activity/activityList#search_box_list",array_merge($filter_param,array('sort'=>'is_new')),''));?>" style="cursor:pointer;">{$Think.lang.newproduct}</a></li>
      </ul>
      <!-- Page -->
      <div class="right text12" id="pagenavi">
        <div class="all-number">
          <span>{$Think.lang.gong}{$page->totalRows}{$Think.lang.commodity}</span>
        </div>
        <p class="pageArea" data-countPage="1"> 
          <!--<a class="bg_img1"></a>-->
          <span class="colf22e01 fontT">{$page->nowPage}</span>
          /
          <span class="page_count fontT">{$page->totalPages}</span>
          <!--<a href="" class="bg_img2"></a> </p>-->
      </div>
      <!-- Page End--> 
    </div>
    <!-- list --> 
  </div>
  <!-- searchbox -->
  <?php } ?>
  <?php if(!$goods_list){ ?>
<div id="tips_message">
					<div class="message_tipws_content">
						<div class="tips_img"><img src="__STATIC__/images/tips_message.png" ></div>
						<div class="tipws_content">
							<!--親！未找到相關商品~<br >查看別的商品，GO！-->
                            {$Think.lang.notproducthint}
							<a href="{:U('Goods/goodsList')}">{$Think.lang.morepriduct} <i class="icon-chevron-right-circle"></i></a>
						</div>
						<div class="clear"></div>
					</div>
				</div>
  <?php } ?>
  <style>
	  #coupon_listgo{width: 50%;text-align: center; float:left; margin:10px 0;}
	  #coupon_listgo a{color:#fff;width: 100%;display: block;}
	  #coupon_listgo a img{ width:100%;}
</style>
 <foreach name="coupon_list" item="v" key="k">
  <div id="coupon_listgo"><a href="javascript:void();" onClick="save_coupon({$v.id})" class="coupon_{$v.id}"><i></i><img src="{$v.original_img}" ></a></div>
 </foreach>
  
<script language="javascript">



 function save_coupon(id)
 {	 	
		$.ajax({
			type : "GET",
			dataType: "json",
			//url:"{:U('Mobile/Coupon/save_coupon')}",
			url:"/index.php?m=Home&c=User&a=save_coupon&id="+id,//+tab,			
			//data:{id:id},
			success: function(data)
			{
				if(data.status=="-1")
					//$.artTip(data.msg, 800)
					alert(data.msg);
				else  
				{
					
					//$(".coupon_"+data.result).css({"background-color":"#797979"});
					//$(".coupon_"+data.result).html('已領取');
					alert("{$Think.lang.receive_success} ");
	
					//alert(data.msg);
					
					//$.artTip(data.msg, 800)
				}
			}
		}); 
 }

</script>
  <ul id="cata_choose_product" class="cart_containt clearfix listContainer">
 
    <foreach name="goods_list" item="v" key="k">
	
      <li <if condition="!($k % 4)">class="item"</if> >
		
		<!-- <div class="bigk"></div> -->
		
        <div class="listbox clearfix"> 
          <!-- 圖片 -->
          <div class="listPic"> 
          		<a rel="nofollow" target="_blank" href="{:U('/Home/Goods/goodsInfo',array('id'=>$v[goods_id]))}" >

				<if condition="$v.original_img1 neq ''">
                	<img  style="display: block;" src="{$v.goods_id|goods_thum_images1=245,327}" dir="{$v.goods_id|goods_thum_images=245,327}" oldurl='{$v.goods_id|goods_thum_images1=245,327}' class="fn_img_lazy">
				<else />
                	<img  style="display: block;" src="{$v.goods_id|goods_thum_images=245,327}" dir=""  oldurl='{$v.goods_id|goods_thum_images=245,327}' class="fn_img_lazy">
				</if>
                </a>             
          </div>
          <div class="list-scroll J_scrollBox clearfix">
            <a href="javascript:void(0);" class="list-scroll-left cbtn"></a>
            <div class="list-scroll-warp J_hideBox">
              <dl class="J_mBox clearfix">            
              
              <foreach name="goods_images" item="v2" key="k2">
                  <if condition="$v2[goods_id] eq $v[goods_id]">
                    <dd>
	                    <a href="javascript:void(0);">
                        	<img width="48"  height="64" data-img="{$v2[image_url]}" src="{$v2[image_url]}" style="display: block;">
                        </a> 
                    </dd>
                  </if>
              </foreach>
              </dl>
            </div>
            <a href="javascript:void(0);" class="list-scroll-right cbtn"></a> </div>
          <div class="clear"></div>
          <!-- 品名 -->
          <div class="listDescript"> <a target="_blank" href="{:U('/Home/Goods/goodsInfo',array('id'=>$v[goods_id]))}" class="text13">{$v[goods_name]}<b>{$v[goods_sn]}</b></a> </div>


          <!-- 價格 -->
          <div class="discountPrice">
            <div class="price-cash">
              <span class="price_list"><if condition="($v[market_price] neq $v[shop_price]) AND ($v[market_price] gt $v[shop_price])" ><em>¥{$v[market_price]}</em> </if>¥{$v[shop_price]}</span>
              <del></del>
			  <div class="morebtn_price">
             
	  <if condition='$v.store_count eq 0'>
               <a href="javascript:;" class="morebtn1" style="background-color: #8A8A8A;" >{$Think.lang.outofstock} </a>
               <else/>
               <a href="javascript:;" class="morebtn1"  onClick="javascript:AjaxAddCart({$v[goods_id]},1,0);">{$Think.lang.addshoppingtrolley} </a>
				  </if>
			  <a href="javascript:;" class="morebtn2" onClick="collect_goods({$v.goods_id});">{$Think.lang.addbookmark} </a>
			  <div class="clear"></div>
			  </div>
            </div>
          </div>
          <!-- 價格 end-->
        </div>
      </li>
	<if condition="!(($k+1) % 4)"><div class="clear"></div></if>
	  
	  
    </foreach>
  </ul>
  
  
	<div class="clear"></div>
  <script type="text/javascript">
$(function(){
  // $('#header').css('left',($(window).width() / 2 - 642.5));
	$("#cata_choose_product li").hover(function(){
			var lazyimg = $(this).find(".fn_img_lazy").attr("dir");
			var src = $(this).find(".fn_img_lazy").attr("src");
			if(lazyimg)
			{
				$(this).find(".fn_img_lazy").attr("dir",src);
				$(this).find(".fn_img_lazy").attr("src",lazyimg);
			}
			$(this).find(".listbox ").addClass("bigk");	
	},function(){
	
			var lazyimg = $(this).find(".fn_img_lazy").attr("dir");
			var src = $(this).find(".fn_img_lazy").attr("src");
			var oldurl = $(this).find(".fn_img_lazy").attr("oldurl");

			if(lazyimg)
			{
				$(this).find(".fn_img_lazy").attr("dir",src);
				$(this).find(".fn_img_lazy").attr("src",lazyimg);
			}
				$(this).find(".fn_img_lazy").attr("src",oldurl);
			$(this).find(".listbox ").removeClass("bigk");	
			
	});		
	
	
});

</script>
  <!-- Page -->
  <div class="fn-page-css-1 pagintion fix" style="display: block;">
  	<div class="pagenavi text12">{$page->show()}</div>
  </div>
  <!-- 商品列表 --> 
</div>
</div>
<!--------中間內容end-------------->   
 

<!--------footer-開始-------------->
<include file="Public/footer" />
<!--------footer-結束-------------->
<script type="text/javascript">

//############   分類導航折疊        ############
$('span[name="submenuicon"]').each(function(){
	 $(this).click(function(){
		 if($(this).hasClass('menuplus')){
			 $(this).removeClass('menuplus').addClass('menuminus');
			 $(this).siblings('.second_div').find('ul').show();
		 }else{
			 $(this).removeClass('menuminus').addClass('menuplus');
			 $(this).siblings('.second_div').find('ul').hide();
		 }
	 });
})
 
//############   更多類別屬性篩選       ###########
$('.f-out-more').click(function(){
  $('.m-tr').each(function(i,o){
    if(i >  7){
      var attrdisplay = $(o).css('display');
      if(attrdisplay == 'none'){
        $(o).css('display','block');
      }
      if(attrdisplay == 'block'){
        $(o).css('display','none');
      }
    }
  });
  if($(this).hasClass('checked')){
    $(this).removeClass('checked tex-center').html('{$Think.lang.put} <i class="checked"></i>');
  }else{
    $(this).addClass('checked tex-center').html('{$Think.lang.moreoptions} ');
  }
})
$('.f-out-more').trigger('click').html('{$Think.lang.moreoptions} '); //  默認點擊壹下

//############   更多條件選擇        ###########
$('.f-more').click(function(){
  if($(this).hasClass('checked')){
    $(this).parent().siblings('ul').removeClass('z-show-more');
    $(this).removeClass('checked').html('{$Think.lang.more} <i></i>');
  }else{
    $(this).parent().siblings('ul').addClass('z-show-more');
    $(this).addClass('checked').html('{$Think.lang.put} <i class="checked"></i>');
  }
})

var cancelBtn = null;
//############   多選框        ###########
$('.f-check').click(function(){
	var _this = this;
	var st = 0;
	//關閉前壹個多選框
	if(cancelBtn != null){
		$(cancelBtn).parent().siblings('ul').removeClass('z-show-more');
		$(cancelBtn).parent().siblings('ul').find('li >a').each(function(i,o){
			$(o).removeClass('select selected');
			$(o).attr('href',$(o).data('href'));
			$(o).children('i').removeClass('selected').css('display','');
			$(o).unbind('click');
		});		
		$(cancelBtn).parent().siblings('.f-ext').show().children('a').removeClass('checked');
		$(cancelBtn).parent().hide();
		$(cancelBtn).siblings().removeClass('u-confirm01');
	}
	cancelBtn = $(_this).parent().siblings('div').find('.u-cancel');
	
	//打開多選框
	$(_this).addClass('checked');
	$(_this).siblings().addClass('checked');
	$(_this).parent().siblings('.g-btns').show();
	$(_this).parent().siblings('ul').addClass('z-show-more');
	$(_this).parent().siblings('ul').find('li>a').each(function(i,o){
		$(o).addClass('select');
		$(o).children('i').css('display','inline');
		$(o).attr('href','javascript:;');
		$(o).bind('click',function(){			
			if($(o).hasClass('selected')){
				$(o).removeClass('selected');
				$(o).children('i').removeClass('selected');
				st--;
			}else{
				$(o).addClass('selected');
				$(o).children('i').addClass('selected');
				$(_this).parent().siblings('.g-btns').children('.u-confirm').addClass('u-confirm01');
				st++;
			}
			//如果沒有選中項,確定按鈕點不了
			if(st==0){
				$(_this).parent().siblings('.g-btns').children('.u-confirm').removeClass('u-confirm01');
			}
		});
	});
	$(_this).parent().hide();
})


//############   取消多選        ###########
$('.g-btns .u-cancel').each(function(){
	$(this).click(function(){
		$(this).parent().siblings('ul').removeClass('z-show-more');
		$(this).parent().siblings('ul').find('li >a').each(function(i,o){
			$(o).removeClass('select selected');
			$(o).attr('href',$(o).data('href'));
			$(o).children('i').removeClass('selected').css('display','');
			$(o).unbind('click');
		});
		$(this).parent().siblings('.f-ext').show().children('a').removeClass('checked');
		$(this).parent().hide();
		$(this).siblings().removeClass('u-confirm01');
	});
})

//############   產品圖片切換        ###########

$('.list-scroll-warp').each(function(){
	var _this = this;
		
	$(_this).children().children().each(function(i,o){
		$(o).mouseover(function(){
			$(o).siblings().removeClass('cur');
			$(o).addClass('cur');			
			var img_src = $(o).children().children().attr('data-img');
			//var imgold_src = $(_this).parent().siblings('.listPic').find('a').children().attr('src');
			$(_this).parent().siblings('.listPic').find('a').children().attr('src',img_src);
			//$(_this).parent().siblings('.listPic').find('a').children().attr('oldurl',imgold_src);
		})
		
		
	})
})

//############   點擊多選確定按鈕      ############
// t 為類型  是品牌 還是 規格 還是 屬性
// btn 是點擊的確定按鈕用於找位置
 get_parment = <?php echo json_encode($_GET); ?>;	
function submitMoreFilter(t,btn)
{
	// 沒有被勾選的時候
	if(!$(btn).hasClass("u-confirm01"))
		return false;
		
	// 獲取現有的get參數		
	var key = ''; // 請求的 參數名稱
	var val = new Array(); // 請求的參數值
	$(btn).parent().siblings(".f-list").find("li > a.selected").each(function(){
		   key = $(this).data('key');
		   val.push($(this).data('val'));
	});
	//parment = key+'_'+val.join('_');
    
	// 品牌
	if(t == 'brand')
	{
		get_parment.brand_id = val.join('_');
	}
	// 規格
	if(t == 'spec')
	{
		if(get_parment.hasOwnProperty('spec'))		
		{		
			get_parment.spec += '@'+key+'_'+val.join('_');
		}		
		else	
		{		
			get_parment.spec = key+'_'+val.join('_');
		}		
	}
	// 屬性
	if(t == 'attr')
	{
		if(get_parment.hasOwnProperty('attr'))		
		{		
			get_parment.attr += '@'+key+'_'+val.join('_');
		}		
		else	
		{		
			get_parment.attr = key+'_'+val.join('_');
		}		
	}
   // 組裝請求的url	
  var url = '';
  for ( var k in get_parment )
  { 
		url += "&"+k+'='+get_parment[k];
  } 

	//console.log('get_parment',get_parment);	
	location.href ="/index.php?m=Home&c=Goods&a=goodsList"+url;
}

</script>
</body>
</html>